#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, UIImageProcessingStyle) {
	UIImageProcessingStyleGray		,		//灰色
	UIImageProcessingStyleInvert	,		//反色
	UIImageProcessingStyleBrown		,		//棕色
};

@interface UIImage (Extension)

+ (UIImage *)imageForColor:(UIColor *)color;
+ (UIImage *)imageForColor:(UIColor *)color size:(CGSize)size;

+ (UIImage *)imageForView:(UIView *)view;
+ (UIImage *)imageForView:(UIView *)view background:(id)background;
+ (UIImage *)imageForView:(UIView *)view background:(id)background overlay:(id)overlay;

+ (UIImage *)imageForTableView:(UITableView *)tableView background:(id)background;

//重置
- (UIImage *)clipToRect:(CGRect)rect;
- (UIImage *)resizeToSize:(CGSize)size;
- (UIImage *)resizeToScale:(CGFloat)scale;
- (UIImage *)rotationToAngle:(CGFloat)angle;
- (UIImage *)mirroredAtYAxis:(BOOL)yAxis;

- (UIImage *)resizableWithCapInsets:(UIEdgeInsets)insets;

//Gradient
- (UIImage *)gradientWithColors:(NSArray <__kindof UIColor *> *)colors orientation:(UIInterfaceOrientation)orientation;
- (UIImage *)gradientWithColors:(NSArray <__kindof UIColor *> *)colors startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint;

//
- (UIImage *)processingWithStyle:(UIImageProcessingStyle)style;

- (UIImage *)grayImage;

- (UIImage *)tintColor:(id)tintColor;		//UIColor 可传入Array实现渐变
- (UIImage *)tintColor:(id)tintColor capInsets:(UIEdgeInsets)insets;

//模糊
- (UIImage *)blurWithRadius:(CGFloat)radius;
- (UIImage *)blurWithRadius:(CGFloat)radius tintColor:(id)tintColor;
- (void)asyncBlurWithRadius:(CGFloat)radius tintColor:(id)tintColor handler:(void(^)(UIImage *image))handler;

//圆角或圆形
- (UIImage *)roundWithSize:(CGSize)size;
- (UIImage *)roundedWithSize:(CGSize)size radius:(CGFloat)radius;
- (UIImage *)roundedWithSize:(CGSize)size radius:(CGFloat)radius borderColor:(UIColor *)color borderWidth:(CGFloat)width;

@end
